package biz.innovasoft.nodb.transaction;

import java.util.Date;

import org.prevayler.Query;

import biz.innovasoft.nodb.impl.GenericRepository;

public class GetSizeByClassQuery implements Query {

	private Class<?>clazz;
	private boolean strict;
	
	public GetSizeByClassQuery (Class<?> clazz, boolean strict) {
		this.clazz = clazz;
		this.strict = strict;
	}
	
	@Override
	public Object query(Object prevSystem, Date time) throws Exception {
		GenericRepository repository = (GenericRepository)prevSystem;
		if (strict) {
			return repository.size(clazz, strict);
		}
		return repository.size(clazz);
	}

}
